//
//  GoodCollectionViewCell.m
//  Menu
//
//  Created by Lynn-Shin on 15/7/3.
//  Copyright (c) 2015年 lijiangang. All rights reserved.
//

#import "GoodCollectionViewCell.h"

@implementation GoodCollectionViewCell

-(instancetype)initWithFrame:(CGRect)frame{
    
    self = [super initWithFrame:frame];
    if (self) {
        
        [self createSubViews];
    }
    return self;
}

-(void)createSubViews{
    
    self.myImage = [[UIImageView alloc] initWithFrame:CGRectMake(15*WIDTH, 10*HEIGHT, 100*WIDTH, 100*HEIGHT)];
//    self.myImage.backgroundColor = [UIColor redColor];
    [self addSubview:self.myImage];
    [self.myImage release];
    
    self.titleLebel = [[UILabel alloc] initWithFrame:CGRectMake(0, 90*HEIGHT, 125*WIDTH, 30*HEIGHT)];
//    self.titleLebel.backgroundColor = [UIColor lightGrayColor];
    self.titleLebel.font = [UIFont systemFontOfSize:15];
    self.titleLebel.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.titleLebel];
    [self.titleLebel release];
    
}

-(void)setGoodModel:(GoodModel *)goodModel{
    
    if (_goodModel != goodModel) {
        [_goodModel release];
        _goodModel = [goodModel retain];
    }
    
    [self.myImage sd_setImageWithURL:[NSURL URLWithString:goodModel.imageFilename]];
    
    self.titleLebel.text = goodModel.name;
    
}

@end
